<?php

	include ('lib/DAO.php');
	session_start();
	
	$haslo = $_POST['pass'];
	$login = $_POST['login'];
		
	$user = DAO::getUser($login, $haslo);
		
	if (empty($user))
	{
		header( 'Location: login_form.php');
	}
	else 
	{
		$_SESSION['user_id'] = $user[0]['id'];
		$_SESSION['user_type'] = $user[0]['type'];		
		header( 'Location: index.php');
	}
	
